package org.example.springbootmybatis.mapper;

import org.example.springbootmybatis.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper //会创建一个UserMapper接口的实现类对象，会添加到IOC容器中
public interface UserMapper {
//    @Select("select * from user")
    public List<User> findAll();

//    @Delete("delete from user where id=${id}")
    public void deleteById(Integer id);


//    @Insert("insert into user(username,password,name,age) values (#{username},#{password},#{name},#{age})")
    public void insert(User user);

//    @Update("update user set username=#{username},password=#{password},name=#{name},age=#{age} where id=#{id}")
    public void update(User user);

//    @Select("select * from user where username=#{username} and password=#{password}")
    public User selectByNameAndPassword(String username, String password);
}
